﻿@model Tau.ViewModels.PublicProductIndexList

@{
    Layout = "~/Views/Shared/_LayoutPublic.cshtml";
    ViewBag.Title = "Products";
}

@Html.Partial("ProductSearch", Model.ProductSearch)

@if (Model != null && Model.PublicProductIndexItems != null && Model.PublicProductIndexItems.Count > 0)
{
    foreach (Tau.ViewModels.PublicProductIndexItem indexItem in Model.PublicProductIndexItems)
    {
        <table width="98%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td>
                    @indexItem.Category.CategoryName
                    <hr />
                </td>
            </tr>
            <tr>
                <td>
                    <table style="font-size:small" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            @foreach (var product in indexItem.Products)
                            { 
                                <td align="center" valign="middle" style="padding-left:5px; padding-right:5px">
                                        <!--product image thumbnail-->
                                    <a href='@Url.Action("GetProduct", "Product", new { id = product.ProductId })'>
                                        <img height="170px" width="135px" src="@Url.Action("GetImage", "Image", new { id = product.ImageId, type = "thumbnail", area = "" })" />
                                    </a>   
                                </td>    
                            }
                        </tr>
                        <tr>
                            @foreach (var product in indexItem.Products)
                            { 
                                <td style="padding-left:5px; padding-right:5px">
                                    <a href='@Url.Action("GetProduct", "Product", new { id = product.ProductId })'>
                                        @product.ProductName.Trim()
                                    </a>
                                    <br />
                                    @string.Format("{0:C}", product.Price)
                                </td>
                            }   
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td style="font-size:smaller; padding:5px 0 15px 0">
                    > <a href='@Url.Action("GetProductsInCategory", "Product", new { id = indexItem.Category.CategoryId })'>see more @indexItem.Category.CategoryName</a>
                </td>
            </tr>
        </table>
    }
}